home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / lib / cryptsetup / scripts / decrypt_gnupg < prev    next >
Encoding:
Text File  |  2011-03-11  |  576 b   |  27 lines

  1. #!/bin/sh
  2.  
  3. decrypt_gpg () {
  4.     echo "Performing GPG key decryption ..." >&2
  5.     if ! /lib/cryptsetup/askpass "Enter passphrase for key $1: " | \
  6.         /usr/bin/gpg -q --batch --no-options --no-mdc-warning  \
  7.         --no-random-seed-file --no-default-keyring \
  8.         --keyring /dev/null --secret-keyring /dev/null \
  9.         --trustdb-name /dev/null --passphrase-fd 0 --decrypt $1; then
  10.         return 1
  11.     fi
  12.     return 0
  13. }
  14.  
  15. if [ ! -x /usr/bin/gpg ]; then
  16.     echo "$0: /usr/bin/gpg is not available" >&2
  17.     exit 1
  18. fi
  19.  
  20. if [ -z "$1" ]; then
  21.     echo "$0: missing key as argument" >&2
  22.     exit 1
  23. fi
  24.  
  25. decrypt_gpg "$1"
  26. exit $?
  27.